package com.ytjj.qmyx.users.utils;

import com.ytjj.common.utils.Aes128CBCUtil;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class SmsToolsUtil {
    /**
     * 解析短链的加密phone
     * @param phoneCode 密文手机号
     * @return  解密出来的手机号
     */
    public static String resolutionSmsToolsPhone(String phoneCode) {
        try {
            phoneCode = phoneCode.replaceAll("%2B", "+");
            phoneCode = phoneCode.replaceAll("%3D", "=");
            phoneCode = phoneCode.replaceAll("%2F", "/");
            String phoneDeCode = Aes128CBCUtil.decrypt(phoneCode, "eCcgc+=F'=M)$+'+", "g&_&J{~mK~e#h_Y2");
            log.debug("===解析短链手机号==={}", phoneDeCode);
            return phoneDeCode;
        } catch (Exception e) {
            log.error("===解析短链手机号异常==={}", e);
        }
        return null;
    }
}
